# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=dlfcn

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}-svn"
pkgver=r37
pkgrel=1
pkgdesc="A wrapper for dlfcn to the Win32 API (mingw-w64)"
arch=('any')
url="http://code.google.com/p/dlfcn-win32"
license=("LGPL")
provides=("${MINGW_PACKAGE_PREFIX}-${_realname}")
conflicts=("${MINGW_PACKAGE_PREFIX}-${_realname}")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
    "subversion")
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs")
source=("${_realname}"::"svn+http://dlfcn-win32.googlecode.com/svn/trunk/")
md5sums=('SKIP')

pkgver() {
  cd "${_realname}"
  local ver="$(svnversion)"
  printf "r%s" "${ver//[[:alpha:]]}"
}

prepare() {
  cd "${srcdir}/${_realname}"
}

build() {
  cd "$srcdir/${_realname}"
  ./configure \
    --prefix=${MINGW_PREFIX} \
    --libdir=${MINGW_PREFIX}/lib \
    --incdir=${MINGW_PREFIX}/include \
    --disable-stripping \
    --enable-shared \
    --disable-msvc
  sed -i "s|libdl.dll |libdl-0.dll |g" Makefile
  make
}

package() {
  cd "${srcdir}/${_realname}"
  make DESTDIR="$pkgdir" install
}
